imwayland: clear preedit on focus out
authorDorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Thu, 23 Aug 2018 10:32:11 +0000 (12:32 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 18 Dec 2018 19:27:12 +0000 (20:27 +0100)
gtk/gtkimcontextwayland.c

index 76b19f8c51cbe5c75d00449c0ece7129bacc7aaf..d3286bf7a5c0568033b39038df7022661bcf8dba 100644 (file)
@@ -119,18 +119,7 @@ static void
 text_input_leave (void                     *data,
                   struct zwp_text_input_v3 *text_input,
                   struct wl_surface        *surface)
-{
-  /*
-  GtkIMContextWayland *context;
-
-  if (!global->current)
-    return;
-
-  context = GTK_IM_CONTEXT_WAYLAND (global->current);
-  TODO: does this clear text input or modify text?
-  reset_preedit (context);
-  */
-}
+{}
 
 static void
 text_input_preedit (void                     *data,
@@ -153,7 +142,6 @@ text_input_preedit (void                     *data,
   context->pending_preedit.cursor_end = cursor_end;
 }
 
-
 static void
 text_input_preedit_apply (GtkIMContextWaylandGlobal *global)
 {
@@ -645,6 +633,11 @@ gtk_im_context_wayland_focus_out (GtkIMContext *context)
 
   zwp_text_input_v3_disable (global->text_input);
   commit_state (context_wayland);
+
+  /* after disable, incoming state changes won't take effect anyway */
+  text_input_preedit (global, global->text_input, "", 0, 0);
+  text_input_preedit_apply (global);
+
   global->current = NULL;
 }